<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn"  uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
	<input type="hidden" id="listPage" value="${cv.calNowPage }">
	<div id="cl-table">
		<div class="cl-header">
			<p style="width: 15%;">시작일</p>
			<p style="width: 15%">마지막일</p>
			<p style="width: 30%">일정명</p>
			<p style="width: 10%">글씨색</p>
			<p style="width: 10%">배경색</p>
			<p style="width: 9%;">삭제</p>
			<p style="width: 11%;">등록일</p>
		</div>
		<c:choose>
			<c:when test="${empty lists }">
				<div class="cl-body">
					<p>입력된 데이타가 없습니다</p>
				</div>
			</c:when>
			<c:otherwise>
				<c:forEach items="${lists }" var="list" varStatus="loop">
					<div class="cl-body">
						<p style="width: 15%; border-left: 3px solid gray;">${fn:substring(list.cal_startdt,0,10) }</p>
						<p style="width: 15%">${fn:substring(list.cal_enddt,0,10) }</p>
						<%-- <p id="cl-body-title" style="width: 30%"><a href="${pageContext.request.contextPath}/homepage/index.jsp?inc_content=./calendar/calendar_edit.jsp?cal_no=${list.cal_no}">${list.cal_title }</a></p> --%>
						<p id="cl-body-title" class="cl-body-title" style="width: 30%"><a href="#" onclick="fnCalView(${list.cal_no})">${list.cal_title }</a></p>
						<p style="width: 10%">${list.cal_font_color }</p>
						<p style="width: 10%">${list.cal_back_color }</p>
						<p style="width: 9%;">
							<input type="button" value="삭제" onclick="fnCalDel(${list.cal_no})">
						</p>
						<p style="width: 11%; border-right: 3px solid gray;">${fn:substring(list.rg_dt,0,10) }</p>
					</div>
				</c:forEach>
			</c:otherwise>
		</c:choose>
	</div>
	<div id="cl-paging" style="margin-top: 20px; text-align: center;" align="center">
		<c:if test="${paging.nowBlock gt 1 }">
			<a onclick="fnPaging(1)"><input type="button" value="맨첨"></a>
			<a onclick="fnPaging(${paging.startPage - 1})"><input type="button" value="이전"></a>
		</c:if>
		[
		<c:forEach var="i" begin="${paging.startPage }" end="${paging.endPage }">
			<c:choose>
				<c:when test="${paging.listPage eq i}">
					<a onclick="fnPaging(${i})"><font color="red" style="font-weight: bold;">${i}</font></a>
				</c:when>
				<c:otherwise>
					<a onclick="fnPaging(${i})">${i}</a>
				</c:otherwise>
			</c:choose>
		</c:forEach>				
		]
		<c:if test="${paging.nowBlock lt paging.totBlock }">
			<a onclick="fnPaging(${paging.endPage + 1})"><input type="button" value="다음"></a>
			<a onclick="fnPaging(${paging.totPage})"><input type="button" value="맨끝"></a>
		</c:if>
	</div>
</body>
</html>